package net.skyaims.lori.context;

import java.io.File;

/**
 * Created by wujianing on 14-5-18.
 */
public class Resource {

    private String baseClassPath;
    private String providerFilePath;
    private String providerClassName;
    private byte[] providerFileBytes;
    private transient File providerFileRefrence;
    private transient Object providerInstance;
    private transient Class<?> providerClassRefrence;
    private transient Class<?>[] providerInterfaceRefrences;

    public String getBaseClassPath() {
        return baseClassPath;
    }

    public void setBaseClassPath(String baseClassPath) {
        this.baseClassPath = baseClassPath;
    }

    public String getProviderFilePath() {
        return providerFilePath;
    }

    public void setProviderFilePath(String providerFilePath) {
        this.providerFilePath = providerFilePath;
    }

    public String getProviderClassName() {
        return providerClassName;
    }

    public void setProviderClassName(String providerClassName) {
        this.providerClassName = providerClassName;
    }

    public byte[] getProviderFileBytes() {
        return providerFileBytes;
    }

    public void setProviderFileBytes(byte[] providerFileBytes) {
        this.providerFileBytes = providerFileBytes;
    }

    public File getProviderFileRefrence() {
        return providerFileRefrence;
    }

    public void setProviderFileRefrence(File providerFileRefrence) {
        this.providerFileRefrence = providerFileRefrence;
    }

    public Object getProviderInstance() {
        return providerInstance;
    }

    public void setProviderInstance(Object providerInstance) {
        this.providerInstance = providerInstance;
    }

    public Class<?> getProviderClassRefrence() {
        return providerClassRefrence;
    }

    public void setProviderClassRefrence(Class<?> providerClassRefrence) {
        this.providerClassRefrence = providerClassRefrence;
    }

    public Class<?>[] getProviderInterfaceRefrences() {
        return providerInterfaceRefrences;
    }

    public void setProviderInterfaceRefrences(Class<?>[] providerInterfaceRefrences) {
        this.providerInterfaceRefrences = providerInterfaceRefrences;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o instanceof Resource) {
            Resource that = (Resource) o;
            if (this.getProviderClassName().equals(that.getProviderClassName())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int hashCode() {
        return this.getProviderClassName().hashCode();
    }

    @Override
    public String toString() {
        return "Resource{" +
                ", providerFilePath='" + providerFilePath + '\'' +
                ", providerClassName='" + providerClassName + '\'' +
                '}';
    }

}
